package logic

import (
	"2210a/commod/commodrpc/commodrpc"
	"2210a/commod/pkg"
	"context"

	"2210a/commod/commodapi/internal/svc"
	"2210a/commod/commodapi/internal/types"

	"github.com/zeromicro/go-zero/core/logx"
)

type ShopShowLogic struct {
	logx.Logger
	ctx    context.Context
	svcCtx *svc.ServiceContext
}

func NewShopShowLogic(ctx context.Context, svcCtx *svc.ServiceContext) *ShopShowLogic {
	return &ShopShowLogic{
		Logger: logx.WithContext(ctx),
		ctx:    ctx,
		svcCtx: svcCtx,
	}
}

func (l *ShopShowLogic) ShopShow(req *types.ShopShowRequest) (resp *types.Response, err error) {
	// todo: add your logic here and delete this line
	show, err := l.svcCtx.CommodEpc.ShopShow(l.ctx, &commodrpc.ShopShowRequest{
		Id:     req.Id,
		UserId: req.UserId,
	})
	if err != nil {
		return &types.Response{
			Code:    500,
			Message: pkg.Trl(err.Error()),
			Data:    nil,
		}, nil
	}
	return &types.Response{
		Code:    200,
		Message: "商品详情展示成功",
		Data:    show,
	}, nil
	return
}
